﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Forms;
using System.IO;
using System.Management;
using System.ComponentModel;


namespace FAST
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window
	{
	    public MainWindow()
		{
            //CheckInstance();
			this.InitializeComponent();
            // Insert code required on object creation below this point.            
        }
		
		//----Start of Custom control bar -----
		private void btnExit_Click(object sender, System.Windows.RoutedEventArgs e)
		{
                System.Windows.Forms.DialogResult dMsg = System.Windows.Forms.MessageBox.Show("Do you want to exit?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dMsg == System.Windows.Forms.DialogResult.Yes)
                {
                    this.Close();
                }                                               
		}
		private void btnMax_Click(object sender, System.Windows.RoutedEventArgs e)
		{
			// TODO: Add event handler implementation here.
			if(this.WindowState != WindowState.Maximized)
				this.WindowState =  WindowState.Maximized;
			else
				this.WindowState =  WindowState.Normal;
		}
		private void btnMin_Click(object sender, System.Windows.RoutedEventArgs e)
		{
			// TODO: Add event handler implementation here.
			this.WindowState  =  WindowState.Minimized;
		}
		private void movingbar(object sender, System.Windows.Input.MouseButtonEventArgs e)
		{
			// TODO: Add event handler implementation here.
			DragMove();

		}
		//----End of Custom control bar -----


		//----Start of Menu bar -----	
		private void bthHome_Click(object sender, System.Windows.RoutedEventArgs e)
		{
			// TODO: Add event handler implementation here.
            lblTitle.Text = "Home";
            Home_Control.setCurrentState("ViewHome");  
			VisualStateManager.GoToState(Home_Control, "ViewHome",false);
			
		}

		private void btnLoadLast_Click(object sender, System.Windows.RoutedEventArgs e)
		{
			// TODO: Add event handler implementation here.
            lblTitle.Text = "Last Folder Pair";
            Home_Control.setCurrentState("ViewLast");
			VisualStateManager.GoToState(Home_Control, "ViewLast",false);
            
			
		}

		private void btnFolderPairs_Click(object sender, System.Windows.RoutedEventArgs e)
		{
			// TODO: Add event handler implementation here.
            Home_Control.setCurrentState("ViewFolderPair");   
			VisualStateManager.GoToState(Home_Control, "ViewFolderPairs",false);            
			lblTitle.Text = "Select a Folder Pair";

		}

		private void btnNew_Click(object sender, System.Windows.RoutedEventArgs e)
		{
			// TODO: Add event handler implementation here.
            lblTitle.Text = "New Folder Pair";
            Home_Control.setCurrentState("ViewNew");                       
			VisualStateManager.GoToState(Home_Control, "ViewFirst",false);			
		}

		private void btnRevert_Click(object sender, System.Windows.RoutedEventArgs e)
		{
			// TODO: Add event handler implementation here.
            Home_Control.setCurrentState("ViewRevert");  
			VisualStateManager.GoToState(Home_Control, "ViewRevert",false);
			lblTitle.Text = "Revert a File";
		}

		private void btnHelp_Click(object sender, System.Windows.RoutedEventArgs e)
		{
			// TODO: Add event handler implementation here.
			VisualStateManager.GoToState(Home_Control, "ViewHelp",false);
			lblTitle.Text = "Help";
		}		
		//----End of Menu bar -----	                   
		
		private void goToConflict(object sender, System.Windows.RoutedEventArgs e)
		{
			// TODO: Add event handler implementation here.
            Home_Control.setCurrentState("ViewConflict"); 
			VisualStateManager.GoToState(Home_Control, "ViewConflict",false);
			lblTitle.Text = "Help";
		}
		/*
        private void CheckInstance()
        {
            Process thisProcess = Process.GetCurrentProcess();

            foreach (Process p in Process.GetProcessesByName(thisProcess.ProcessName))
            {

                if (p.Id != thisProcess.Id)
                {
                    System.Windows.Forms.MessageBox.Show("You Already Have an instance running");
                    this.Close();

                }
            }
        }
         */
	}
}